#!/bin/bash
echo 'export PATH=$PATH:/usr/local/mysql/mysql/bin' >> /etc/profile
source /etc/profile
exe=/usr/local/mysql/mysql/bin
$exe/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql/mysql
$exe/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/mysql/data &> /dev/null
systemctl daemon-reload
systemctl restart mysqld
systemctl enable mysqld
ln -s /lib64/libncurses.so.6 /lib64/libncurses.so.5
ln -s /lib64/libtinfo.so.6 /lib64/libtinfo.so.5
zcat /opt/full.sql.gz | $exe/mysql -uroot -S /tmp/mysql.sock
$exe/mysql -uroot -S /tmp/mysql.sock <<EOF
change replication source to source_host='192.168.88.129',
source_user='slave',
source_password='123456',
source_auto_position=1;
start slave;
EOF
